package com.yaoyong.yy_demo.module.poi;

import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;

public class Main {
    public static void main(String[] args) throws IOException {

        String[] title = {"名称", "性别"};
        String[][] content = {{"李四", "男"}, {"张三", "女"}};
        Workbook wb = ExcelUtil.exportExcel("excel测试", title, content, 2, new XSSFWorkbook());
        wb.write(new FileOutputStream("./src/main/java/com/yaoyong/yy_demo/module/poi/xxxx.xlsx"));
        System.out.println("===============================");
        List<String[]> strings = ExcelUtil.importExcel(null, null, new FileInputStream("./src/main/java/com/yaoyong/yy_demo/module/poi/xxxx.xlsx"));
        for (String[] string : strings) {
            for (String s : string) {
                System.out.print(s + " ,");
            }
            System.out.println();
        }

    }
}
